/*     */ package com.feeyin.radar.sys.dao.impl;
/*     */ 
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.sys.dao.DataDictionaryDAO;
/*     */ import com.feeyin.radar.sys.dao.RecordRangeDAO;
/*     */ import com.feeyin.radar.sys.model.DataDictionary;
/*     */ import com.feeyin.radar.sys.model.RecordRange;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import org.springframework.orm.ibatis.SqlMapClientTemplate;
/*     */ import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
/*     */ 
/*     */ public class RecordRangeDAOImpl extends SqlMapClientDaoSupport
/*     */   implements RecordRangeDAO
/*     */ {
/*     */   private DataDictionaryDAO dataDictionaryDAO;
/*     */ 
/*     */   public DataDictionaryDAO getDataDictionaryDAO()
/*     */   {
/*  25 */     return this.dataDictionaryDAO;
/*     */   }
/*     */ 
/*     */   public void setDataDictionaryDAO(DataDictionaryDAO dataDictionaryDAO) {
/*  29 */     this.dataDictionaryDAO = dataDictionaryDAO;
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByDictionaryId(Integer dictionaryId) {
/*  33 */     return getSqlMapClientTemplate().queryForList("getActivityRecordRangesByDictionaryId", dictionaryId);
/*     */   }
/*     */ 
/*     */   public List getRecordRangesByDictionaryId(Integer dictionaryId) {
/*  37 */     return getSqlMapClientTemplate().queryForList("getRecordRangesByDictionaryId", dictionaryId);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByParentId(Integer parentId) {
/*  41 */     return getSqlMapClientTemplate().queryForList("getActivityRecordRangesByParentId", parentId);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByLevel(Integer level) {
/*  45 */     return getSqlMapClientTemplate().queryForList("getActivityRecordRangesByLevel", level);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByDictionaryIdAndRangeValue(Integer dictionaryId, String rangeValue) {
/*  49 */     if (dictionaryId == null) return null;
/*  50 */     if (StringUtils.isEmpty(rangeValue)) return null;
/*  51 */     Map map = new HashMap();
/*  52 */     map.put("dataDictionaryId", dictionaryId);
/*  53 */     map.put("rangeValue", rangeValue);
/*  54 */     return getSqlMapClientTemplate().queryForList("getActivityRecordRangesByDictionaryIdAndRangeValue", map);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByParentIdAndRangeValue(Integer parentId, String rangeValue)
/*     */   {
/*  59 */     Map map = new HashMap();
/*  60 */     map.put("parentId", parentId);
/*  61 */     map.put("rangeValue", rangeValue);
/*  62 */     return getSqlMapClientTemplate().queryForList("getActivityRecordRangesByParentIdAndRangeValue", map);
/*     */   }
/*     */ 
/*     */   public List getActivityRecordRangesByDictionaryCode(String recordCode) {
/*  66 */     if (StringUtils.isEmpty(recordCode)) return null;
/*  67 */     DataDictionary dataDictionary = new DataDictionary();
/*  68 */     dataDictionary = this.dataDictionaryDAO.getDataDictionaryByRecordCode(recordCode);
/*  69 */     if (dataDictionary == null) return null;
/*  70 */     return getActivityRecordRangesByDictionaryId(dataDictionary.getId());
/*     */   }
/*     */ 
/*     */   public RecordRange getRecordRangeById(Integer id) {
/*  74 */     if (id == null) return null;
/*  75 */     return (RecordRange)getSqlMapClientTemplate().queryForObject("getRecordRangeById", id);
/*     */   }
/*     */ 
/*     */   public RecordRange getRecordRangeByRangeCode(String rangeCode) {
/*  79 */     if (StringUtils.isEmpty(rangeCode)) return null;
/*  80 */     return (RecordRange)getSqlMapClientTemplate().queryForObject("getRecordRangeByRangeCode", rangeCode);
/*     */   }
/*     */ 
/*     */   public String getRecordRangeValueById(Integer id) {
/*  84 */     if (id == null) return null;
/*  85 */     String rangeValue = "";
/*  86 */     RecordRange recordRange = new RecordRange();
/*  87 */     recordRange = getRecordRangeById(id);
/*  88 */     if (recordRange == null) return null;
/*  89 */     rangeValue = recordRange.getRangeValue();
/*  90 */     return rangeValue;
/*     */   }
/*     */ 
/*     */   public boolean insertRecordRange(RecordRange recordRange) {
/*  94 */     if (recordRange == null) return false;
/*  95 */     if (StringUtils.isEmpty(recordRange.getRangeCode())) return false;
/*  96 */     Integer result = (Integer)getSqlMapClientTemplate().insert("insertRecordRange", recordRange);
/*  97 */     return getRecordRangeByRangeCode(recordRange.getRangeCode()) != null;
/*     */   }
/*     */ 
/*     */   public boolean updateRecordRangeNotActivity(Integer id)
/*     */   {
/* 103 */     Integer result = Integer.valueOf(getSqlMapClientTemplate().update("updateRecordRangeNotActivity", id));
/* 104 */     return result != null;
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.dao.impl.RecordRangeDAOImpl
 * JD-Core Version:    0.6.0
 */